//
//  SVoiceRecordButton.h
//  EasyRetail
//
//  Created by Samuel on 10/16/15.
//
//

#import <UIKit/UIKit.h>
@protocol SVoiceRecordButtonDelegate;
@interface SVoiceRecordButton : UIButton
@property (nonatomic, strong)NSObject<SVoiceRecordButtonDelegate> *delegate;
#pragma mark - 音頻錄製功能
/**
 *  是否打開音頻錄製功能
 */
@property (nonatomic,assign)BOOL isOpenRecord;
/**
 *  最小錄製時間
 */
@property (nonatomic, assign)float minRecordTime;



#pragma mark - 音頻播放功能（自動）初始化時候複製
/**
 *  是否打開音頻播放功能
 */
@property (nonatomic,assign)BOOL isOpenPlay;
/**
 *  音頻數據
 */
@property (nonatomic,strong)NSData *voiceData;
/**
 *  音頻名
 */
@property (nonatomic,strong)NSString *voiceName;


#pragma mark - 音頻播放功能（手動）點擊事件執行時候調用
/**
 *  播放音頻
 *
 *  @param string 音頻名稱
 */
- (void)playVoiceWithName:(NSString*)name;
/**
 *  播放音頻
 *
 *  @param string 音頻名稱
 */
- (void)playVoiceWithData:(NSData*)data;
/**
 *  停止播放
 */
- (void)stopVoice;
/**
 *  刪除本地音頻文件
 *
 *  @param string 音頻名稱
 */
- (void)deleteVoice:(NSString*)name;

/**
 *  獲取音頻時長
 *
 *  @param path 路徑
 *
 *  @return 時間
 */
- (float)getVoiceTimeWihtName:(NSString*)name;

@end

@protocol SVoiceRecordButtonDelegate <NSObject>
@required

@optional
- (void)sVoiceRecord:(SVoiceRecordButton *)sVoiceRecordButton andRecotdTime:(float)time andVoiceName:(NSString*)name;

- (void)sVoiceRecordStart:(SVoiceRecordButton *)sVoiceRecordButton;

- (void)sVoiceRecordOutSide:(SVoiceRecordButton *)sVoiceRecordButton;

- (void)sVoiceRecordInSide:(SVoiceRecordButton *)sVoiceRecordButton;

@end
